<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Product extends Front_Controller{	
	protected $assignData = array();

	function __construct(){
		parent::__construct();
	}
	
	/*
	 * 采样中心
	 */
	function smaple(){
		$this->setWebTitle('采样中心');
		$p = $this->uri->segment(3);
		$result = $this->JayphaDB->getPage($this->db_table_prefix.'products', '*', array('isadmin'=>0), 'id desc', $p, 10,'product/sell');
		$this->assignData['result'] = $result['result'];
		$this->assignData['page_bar'] = $result['page_bar'];
		$this->load->view('product/smaple', $this->assignData);
		return;
	}

	/*
	 * 供求信息
	 */
	function sell(){
		$this->setWebTitle('供应信息');
		$p = $this->uri->segment(3);
		$result = $this->JayphaDB->getPage($this->db_table_prefix.'products', '*', array('isadmin'=>0), 'id desc', $p, 1,'product/sell');
		$this->assignData['result'] = $result['result'];
		$this->assignData['page_bar'] = $result['page_bar'];
		$this->load->view('product/sell', $this->assignData);
		return;
	}

	/*
	 * 采购信息
	 */
	function buy(){
		$this->setWebTitle('采购信息');
		$p = $this->uri->segment(3);
		$result = $this->JayphaDB->getPage($this->db_table_prefix.'products', '*', array('isadmin'=>1), 'id desc', $p, 1,'product/buy');
		$this->assignData['result'] = $result['result'];
		$this->assignData['page_bar'] = $result['page_bar'];
		$this->load->view('product/buy', $this->assignData);
		return;
	}

	//发布采购信息
	public function release() {
		if (!isset($this->session->userdata['name']) || empty($this->session->userdata['name'])) {
			$this->showmsg('请先登陆！', 'product/release');
		}
		$this->setWebTitle('发布采购信息');
		$this->load->view('product/release', $this->assignData);
		return;
	}

	//发布采购信息
	public function search() {
		$this->setWebTitle('搜索');
		$this->load->view('product/search', $this->assignData);
		return;
	}

	//产品详细页面
	public function detail() {
		//$this->setWebTitle('搜索');
		$this->load->view('product/detail', $this->assignData);
		return;
	}
}
?>